using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PHYSICIAN_AMOUNTMap : EntityTypeConfiguration<SO_PHYSICIAN_AMOUNT>
    {
        public SO_PHYSICIAN_AMOUNTMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Transaction_id, t.ITEM, t.PHYSICIAN, t.PERCENTAGE, t.PHYSICIAN_AMOUNT, t.GUARANTOR1_AMOUNT, t.GUARANTOR2_AMOUNT, t.SUMFIELDS });

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(8);

            this.Property(t => t.Transaction_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.PHYSICIAN)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.SYMBOL)
                .HasMaxLength(5);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(53);

            // Table & Column Mappings
            this.ToTable("SO_PHYSICIAN_AMOUNT");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Transaction_id).HasColumnName("Transaction_id");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.PHYSICIAN).HasColumnName("PHYSICIAN");
            this.Property(t => t.PERCENTAGE).HasColumnName("PERCENTAGE");
            this.Property(t => t.SYMBOL).HasColumnName("SYMBOL");
            this.Property(t => t.PHYSICIAN_AMOUNT).HasColumnName("PHYSICIAN_AMOUNT");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.GUARANTOR1_AMOUNT).HasColumnName("GUARANTOR1_AMOUNT");
            this.Property(t => t.GUARANTOR2_AMOUNT).HasColumnName("GUARANTOR2_AMOUNT");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
        }
    }
}
